package cv.cvut.felk.via.sm.services;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cz.cvut.felk.via.sm.model.File;


public class FileDummyService {
	
	Map<String,List<File>> filesToSubject = new HashMap<String, List<File>>();
	List<File> files= new ArrayList<File>();
	public FileDummyService() {
		
		
		
		File file = new File();
		file.setName("Prednaska1");
		file.setContent(null);
		file.setId(1);
		file.setWeek(1);
		files.add(file);	
		filesToSubject.put("Y35mtm", files);
		
		
		file = new File();
		files= new ArrayList<File>();
		file.setName("Prednaska2");
		file.setContent(null);
		file.setId(2);
		file.setWeek(2);
		files.add(file);	
		filesToSubject.put("Y35fzk", files);
		
		
		file = new File();
		files= new ArrayList<File>();
		file.setName("Prednaska5");
		file.setContent(null);
		file.setId(3);
		file.setWeek(5);
		files.add(file);	
		filesToSubject.put("a4m33pal", files);
		
		file = new File();
		files= new ArrayList<File>();
		file.setName("CviceniDona");
		file.setContent(null);
		file.setId(4);
		file.setWeek(11);
		files.add(file);
		
		file = new File();
		file.setName("Priklady");
		file.setContent(null);
		file.setId(5);
		file.setWeek(5);
		files.add(file);	
		
		file = new File();
		file.setName("Teorie");
		file.setContent(null);
		file.setId(6);
		file.setWeek(5);
		files.add(file);	
		filesToSubject.put("X36DSA", files);
		
		
		file = new File();
		files= new ArrayList<File>();
		file.setName("DomaciUkol");
		file.setContent(null);
		file.setId(7);
		file.setWeek(9);
		files.add(file);
		
		file = new File();
		file.setName("PraktickaCast");
		file.setContent(null);
		file.setId(8);
		file.setWeek(12);
		files.add(file);	
		
		file = new File();
		file.setName("Prednaska7");
		file.setContent(null);
		file.setId(9);
		file.setWeek(7);
		files.add(file);	
		filesToSubject.put("X36LOB", files);
		
		
		file = new File();
		files= new ArrayList<File>();
		file.setName("Teorie");
		file.setContent(null);
		file.setId(10);
		file.setWeek(2);
		files.add(file);
		
		file = new File();
		file.setName("Prednaska8");
		file.setContent(null);
		file.setId(11);
		file.setWeek(8);
		files.add(file);	
		
		file = new File();
		file.setName("Ukol");
		file.setContent(null);
		file.setId(12);
		file.setWeek(7);
		files.add(file);	
		filesToSubject.put("X36PAA", files);
		
		
		file = new File();
		files= new ArrayList<File>();
		file.setName("Assembler");
		file.setContent(null);
		file.setId(13);
		file.setWeek(2);
		files.add(file);
		
		file = new File();
		file.setName("MaterialySKD");
		file.setContent(null);
		file.setId(14);
		file.setWeek(8);
		files.add(file);	
		
		file = new File();
		file.setName("Prednaska9");
		file.setContent(null);
		file.setId(15);
		file.setWeek(9);
		files.add(file);	
		filesToSubject.put("X36SKD", files);
		
		
		
		
	}
	
	public List<File> getSubjectFiles(String subject,int week){
		List<File> files = filesToSubject.get(subject);
		List<File> result = new ArrayList<File>();
		if(files==null){
			return null;
		}else{
			for(File file:files){
				if(file.getWeek()<=week){
					result.add(file);
				}
				
			}
			return result;
		}
	}
	public File addFile(String subjectcode,File file){
		List<File> files = filesToSubject.get(subjectcode);
		if(files==null){
			return null;
		}
		files.add(file);
		return file;
	}
	
}
